<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>03循环遍历指令</title>
  </head>
  <body>
    <div>
      {{info}}
      <ul>
        <li v-for="name in arr">{{name}}</li>
      </ul>
      <table border="1">
        <caption>
          商品表
        </caption>
        <tr>
          <td>编号</td>
          <td>名称</td>
          <td>价格</td>
          <td>颜色</td>
          <td>销量</td>
        </tr>
        <tr v-for="(sale, num) in product">
          <td>{{num+1}}</td>
          <td>{{sale.title}}</td>
          <td>{{sale.price}}</td>
          <td>{{sale.color}}</td>
          <td>{{sale.sale}}</td>
        </tr>
      </table>
    </div>
  </body>
  <script src="./js/vue.min.js"></script>
  <script>
    let v = new Vue({
      el: "body>div",
      data: {
        info: "循环遍历",
        arr: [
          "张三",
          "李四",
          "王五",
          "赵六",
          "钱七",
          "孙八",
          "张三",
          "李四",
          "王五",
          "赵六",
          "钱七",
          "孙八",
        ],
        product: [
          {
            title: "iPhone 15 ProMax",
            price: "10599",
            color: "蓝色",
            sale: 19822,
          },
          {
            title: "华为Mate 60Pro+",
            price: "10599",
            color: "蓝色",
            sale: 19822,
          },
          {
            title: "小米14 Ultra",
            price: "10599",
            color: "绿色",
            sale: 19822,
          },
          {
            title: "Vivo X100 Pro+",
            price: "10599",
            color: "白色",
            sale: 19822,
          },
          {
            title: "红米 K70",
            price: "10599",
            color: "黑色",
            sale: 19822,
          },
        ],
      },
      methods: {},
    });
  </script>
</html>
